<?php

namespace App\Models\base;

use App\Models\AdminModel;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model as BaseModel;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;

class SubjectModel extends BaseModel
{
    use HasFactory, SoftDeletes;

    protected $table = 't_base_subject';

    protected $primaryKey = 'id';

    public $timestamps = true;

    const CREATED_AT = 'created_at';
    
    const UPDATED_AT = null;

    const TYPE_ARRAY = [
       '1' => '应收',
       '2' => '应付',
    ];

    protected $guarded = [];

    protected $hidden = [
        'deleted_at',
    ];


    //创建人
    public function create_admin(): BelongsTo {
        return $this->belongsTo(AdminModel::class, 'created_admin_id');
    }

}
